========================================================================= 
Log Path: ./log/log.log 
Program Path: /home/rstudio/spasim_repl/00_full.R 
Working Directory: /home/rstudio/spasim_repl 
User Name: rstudio 
R Version: 4.2.1 (2022-06-23) 
Machine: garret x86_64 
Operating System: Linux 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 
Base Packages: stats graphics grDevices utils datasets methods base Other Packages: tidylog_1.0.2 logr_1.3.3 xtable_1.8-4 forcats_0.5.1 ggplot2_3.3.6 tidyr_1.2.0 dplyr_1.0.9 abind_1.4-5 posterior_1.2.2 bayesplot_1.9.0 cmdstanr_0.5.2 brms_2.19.0 Rcpp_1.0.8.3 
Log Start Time: 2023-04-18 09:02:56 
========================================================================= 

> # Replication Code for:
> # The Comparative Meaning of Political Space: A Comprehensive Modeling Approach
> # Author: Garret Binding / Jelle Koedam / Marco Steenbergen
> # Created: 3/1/2023
>   
> rm(list = ls());gc()
> 
> library(brms)
> library(cmdstanr)
> library(bayesplot)
> library(posterior)
> library(abind)
> library(dplyr)
> library(tidyr)
> library(ggplot2)
> library(forcats)
> library(xtable)
> library(logr)
> 
> options("logr.autolog" = TRUE)
> # Open the log
> lf <- log_open(file.path("log.log"))
> # Send message to log
> log_code()
> 
> sessionInfo()
> 
> # R version 4.2.1 (2022-06-23)
> # Platform: x86_64-pc-linux-gnu (64-bit)
> # Running under: Ubuntu 20.04.4 LTS
> # 
> # Matrix products: default
> # BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
> # LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
> # 
> # locale:
> #   [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
> # [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
> # [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
> # 
> # attached base packages:
> #   [1] stats     graphics  grDevices utils     datasets  methods   base     
> # 
> # other attached packages:
> #   [1] logr_1.3.3      xtable_1.8-4    forcats_0.5.1   ggplot2_3.3.6   tidyr_1.2.0     dplyr_1.0.9     abind_1.4-5     posterior_1.2.2 bayesplot_1.9.0
> # [10] cmdstanr_0.5.2  brms_2.17.0     Rcpp_1.0.8.3   
> # 
> # loaded via a namespace (and not attached):
> #   [1] nlme_3.1-157           matrixStats_0.62.0     xts_0.12.1             threejs_0.3.3          rstan_2.21.5           tensorA_0.36.2        
> # [7] tools_4.2.1            backports_1.4.1        utf8_1.2.2             R6_2.5.1               DT_0.23                DBI_1.1.3             
> # [13] colorspace_2.0-3       withr_2.5.0            tidyselect_1.2.0       gridExtra_2.3          prettyunits_1.1.1      processx_3.6.1        
> # [19] Brobdingnag_1.2-7      compiler_4.2.1         cli_3.4.1              shinyjs_2.1.0          colourpicker_1.1.1     scales_1.2.0          
> # [25] dygraphs_1.1.1.6       checkmate_2.1.0        mvtnorm_1.1-3          ggridges_0.5.3         callr_3.7.0            stringr_1.4.0         
> # [31] digest_0.6.29          StanHeaders_2.21.0-7   base64enc_0.1-3        pkgconfig_2.0.3        htmltools_0.5.2        fastmap_1.1.0         
> # [37] htmlwidgets_1.5.4      rlang_1.0.6            rstudioapi_0.13        shiny_1.7.1            farver_2.1.0           generics_0.1.2        
> # [43] zoo_1.8-10             jsonlite_1.8.0         crosstalk_1.2.0        gtools_3.9.2.2         distributional_0.3.0   inline_0.3.19         
> # [49] magrittr_2.0.3         loo_2.5.1              Matrix_1.4-1           munsell_0.5.0          fansi_1.0.3            lifecycle_1.0.3       
> # [55] stringi_1.7.6          pkgbuild_1.3.1         plyr_1.8.7             grid_4.2.1             parallel_4.2.1         promises_1.2.0.1      
> # [61] crayon_1.5.1           miniUI_0.1.1.1         lattice_0.20-45        knitr_1.39             ps_1.7.1               pillar_1.7.0          
> # [67] igraph_1.3.2           markdown_1.1           shinystan_2.6.0        reshape2_1.4.4         codetools_0.2-18       stats4_4.2.1          
> # [73] rstantools_2.2.0       glue_1.6.2             data.table_1.14.2      RcppParallel_5.1.5     vctrs_0.5.1            httpuv_1.6.5          
> # [79] gtable_0.3.0           purrr_0.3.4            assertthat_0.2.1       xfun_0.31              mime_0.12              this.path.helper_0.1.0
> # [85] coda_0.19-4            later_1.3.0            this.path_1.2.0        tibble_3.1.7           shinythemes_1.2.0      ellipsis_0.3.2        
> # [91] bridgesampling_1.1-2
> 
> options(mc.cores = parallel::detectCores())
> 
> set.seed(2022)
> 
> # load data ####
> df_id <- read.csv("data/CHES2019V3.csv") %>% 
>   dplyr::select(country, eastwest, party_id) %>% 
>   distinct()
> 
> df_pid <- read.csv("data/1999-2019_CHES_dataset_means(v1).csv")[,1:14] %>% 
>   filter(year == 2019)
> 
> df <- read.csv("data/CHES2019_experts.csv") %>% 
>   merge(df_id, by = "party_id") %>% 
>   filter({eastwest == 1 & !(country %in% c("cyp", "lux"))} | {is.na(eastwest) & !(country %in% c("tur", "swi", "nor", "ice"))}) %>% 
>   dplyr::select(country:eastwest, 
>                 party_id:party_name,
>                 immigrate_policy, multiculturalism, redistribution, environment, spendvtax, deregulation, econ_interven, civlib_laworder, sociallifestyle, religious_principles,
>                 ethnic_minorities, nationalism, urban_rural, protectionism, regions, # people_vs_elite, 
>                 eu_position = position, eu_cohesion, eu_foreign, eu_intmark, eu_budgets, eu_asylum, lrgen, lrecon, galtan) %>% 
>   mutate(expert = paste0(country, ".", id))
> 
> df$lrgen[df$lrgen == -1] <- NA
> df$lrecon[df$lrecon == -1] <- NA
> df$galtan[df$galtan == -1] <- NA
> df$lrecon[df$lrecon %in% c("", ".d")] <- NA
> df$galtan[df$galtan %in% c("", ".d")] <- NA
> df$lrecon <- as.numeric(df$lrecon)
> df$galtan <- as.numeric(df$galtan)
> 
> df[,7:21] <- df[,7:21] + 1
> 
> p_id <- 1:length(unique(df$party_id)) # parties
> c_id <- 1:length(unique(df$country)) # countries
> e_id <- 1:length(unique(df$expert)) # experts
> i_id <- 1:21 # issues
> 
> names(p_id) <- as.character(unique(df$party_id))
> names(c_id) <- unique(df$country)
> names(e_id) <- unique(df$expert)
> names(i_id) <- colnames(df[,7:27])
> 
> df$p_id <- p_id[as.character(df$party_id)]
> df$c_id <- c_id[df$country]
> df$e_id <- e_id[df$expert]
> 
> # starting values (to address rotational invariance)
> p_start <- df %>% 
>   select(p_id, lrgen, lrecon, galtan) %>% 
>   group_by(p_id) %>% 
>   summarize(lr = median(lrgen, na.rm = T),
>             lrecon = median(lrecon, na.rm = T),
>             galtan = median(galtan, na.rm = T)) %>% 
>   ungroup()
> p_start[,2:4] <- apply(p_start[,2:4], 2, function(x) (x - mean(x)) / sd(x))
> p_start <- p_start %>% 
>   arrange(p_id)
> 
> df_long <- df[, c(7:27, 32:34)] %>% 
>   pivot_longer(cols = 1:21)
> df_long$i_id <- i_id[df_long$name]
> df_long <- na.omit(df_long)
> 
> # run models ####
> dir.create("out")
> source("01_run_models.R")
> 
> # extract main qoi ####
> source("02_write_out.R")
> 
> # generate figures and tables ####
> dir.create("figures")
> dir.create("tables")
> source("03_main.R")
> 
> log_close()

distinct: no rows removed

NOTE: Log Print Time:  2023-04-18 09:02:56 
NOTE: Elapsed Time: 0.107227087020874 secs 

filter: removed 949 rows (79%), 247 rows remaining

NOTE: Log Print Time:  2023-04-18 09:02:56 
NOTE: Elapsed Time: 0.0573222637176514 secs 

filter: removed 2,127 rows (56%), 1,683 rows remaining

NOTE: Log Print Time:  2023-04-18 09:02:56 
NOTE: Elapsed Time: 0.136309146881104 secs 

mutate: new variable 'expert' (character) with 191 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 09:02:56 
NOTE: Elapsed Time: 0.029064416885376 secs 

select: dropped 30 variables (country, eastwest, party_id, id, party, …)

NOTE: Log Print Time:  2023-04-18 09:02:56 
NOTE: Elapsed Time: 0.0214776992797852 secs 

group_by: one grouping variable (p_id)

NOTE: Log Print Time:  2023-04-18 09:02:56 
NOTE: Elapsed Time: 0.0106565952301025 secs 

summarize: now 128 rows and 4 columns, ungrouped

NOTE: Log Print Time:  2023-04-18 09:02:56 
NOTE: Elapsed Time: 0.0261385440826416 secs 

ungroup: no grouping variables

NOTE: Log Print Time:  2023-04-18 09:02:56 
NOTE: Elapsed Time: 0.00216126441955566 secs 

pivot_longer: reorganized (immigrate_policy, multiculturalism, redistribution, environment, spendvtax, …) into (name, value) [was 1683x24, now 35343x5]

NOTE: Log Print Time:  2023-04-18 09:02:56 
NOTE: Elapsed Time: 0.0274317264556885 secs 

> # Send message to log
> log_code()
> 
> stan_data <- list(
>   C = length(c_id),
>   P = length(p_id),
>   I = length(i_id),
>   E = length(e_id),
>   F1 = 1,
>   F2 = 1,
>   p = df_long$value,
>   N = nrow(df_long),
>   e_id = df_long$e_id,
>   c_id = df_long$c_id,
>   p_id = df_long$p_id,
>   i_id = df_long$i_id,
>   free_experts = 0,
>   country_issue_shocks = 0,
>   party_issue_shocks = 0,
>   country_shocks = 0,
>   f1 = c(1:dim(df[,7:27])[2])[!(1:dim(df[,7:27])[2] %in% c(1))],
>   f2 = c(1:dim(df[,7:27])[2])[!(1:dim(df[,7:27])[2] %in% c(7))],
>   f1z = array(c(1), c(1,1)), # constrained issue
>   f2z = array(c(7), c(1,1)) # constrained issue
> )
> 
> # setting up starting values
> initF <- function(){
>   list(theta_free = as.matrix(p_start[,c("lrecon","galtan")], ncol = 2),
>        mu_alpha = matrix(seq(-2, 2, length.out = 10), stan_data$I, 10, byrow = TRUE),
>        hyp_p = c(1, 1, .1, .1, .1, .1),
>        res_beta_r1 = matrix(0, stan_data$I-stan_data$F1, stan_data$C),
>        res_beta_r2 = matrix(0, stan_data$I-stan_data$F2, stan_data$C),
>        res_alpha_r = matrix(0, stan_data$I, stan_data$C),
>        scales_beta_1 = rep(1/(stan_data$I-stan_data$F1), stan_data$I-stan_data$F1),
>        scales_beta_2 = rep(1/(stan_data$I-stan_data$F2), stan_data$I-stan_data$F2),
>        scales_alpha = rep(1/stan_data$I, stan_data$I),
>        L_beta_1 = chol(diag(rep(1, stan_data$I-stan_data$F1))),
>        L_beta_2 = chol(diag(rep(1, stan_data$I-stan_data$F2))),
>        L_alpha = chol(diag(rep(1, stan_data$I))),
>        exp_scale_free = brms::rdirichlet(1, rep(100, stan_data$E)),
>        scale_beta_free = brms::rdirichlet(1, rep(100, stan_data$C)),
>        shift_alpha_free = (rnorm(stan_data$C, 0, .001)),
>        idio_r = matrix(0, nrow = stan_data$I, ncol = stan_data$P))
> }
> 
> mod <- cmdstan_model("full_model.stan")
> 
> # baseline model ####
> fit <- mod$sample(data = stan_data, 
>                   init = initF,
>                   chains = 8,
>                   iter_warmup = 500, iter_sampling = 500)
> 
> loo_m0 <- loo(fit$draws("log_lik"))
> pred_m0 <- fit$draws("p_share")
> df_m0 <- fit$summary(c("mu_beta_1", "mu_beta_2", "mu_alpha", "theta", "p_share"))
> save(df_m0, loo_m0, pred_m0, file = "out/m0.Rda")
> 
> gc();rm(fit);Sys.sleep(30);gc()
> 
> # heteroskedastic experts model ####
> stan_data$free_experts <- 1
> 
> fit <- mod$sample(data = stan_data, 
>                   init = initF,
>                   chains = 8,
>                   iter_warmup = 500, iter_sampling = 500)
> 
> loo_m1 <- loo(fit$draws("log_lik"))
> pred_m1 <- fit$draws("p_share")
> df_m1 <- fit$summary(c("mu_beta_1", "mu_beta_2", "mu_alpha", "theta", "p_share", "exp_scale"))
> save(df_m1, loo_m1, pred_m1, file = "out/m1.Rda")
> 
> gc();rm(fit);Sys.sleep(30);gc()
> 
> # idiosyncratic preferences model ####
> stan_data$free_experts <- 0
> stan_data$party_issue_shocks <- 1
> 
> fit <- mod$sample(data = stan_data, 
>                   init = initF,
>                   chains = 8,
>                   iter_warmup = 500, iter_sampling = 500)
> 
> loo_m2 <- loo(fit$draws("log_lik"))
> pred_m2 <- fit$draws("p_share")
> df_m2 <- fit$summary(c("mu_beta_1", "mu_beta_2", "mu_alpha", "theta", "p_share", "LL_alpha"))
> save(df_m2, loo_m2, pred_m2, file = "out/m2.Rda")
> 
> gc();rm(fit);Sys.sleep(30);gc()
> 
> # A-M model ####
> stan_data$party_issue_shocks <- 0
> stan_data$country_shocks <- 1
> 
> fit <- mod$sample(data = stan_data, 
>                   init = initF,
>                   chains = 8,
>                   iter_warmup = 500, iter_sampling = 500)
> 
> loo_m3 <- loo(fit$draws("log_lik"))
> pred_m3 <- fit$draws("p_share")
> df_m3 <- fit$summary(c("mu_beta_1", "mu_beta_2", "mu_alpha", "theta", "p_share", "LL_alpha", "shift_alpha", "scale_beta"))
> save(df_m3, loo_m3, pred_m3, file = "out/m3.Rda")
> 
> gc();rm(fit);Sys.sleep(30);gc()
> 
> # country-issue shocks model ####
> stan_data$country_shocks <- 0
> stan_data$country_issue_shocks <- 1
> 
> fit <- mod$sample(data = stan_data, 
>                   init = initF,
>                   chains = 8,
>                   iter_warmup = 500, iter_sampling = 500)
> 
> loo_m4 <- loo(fit$draws("log_lik"))
> pred_m4 <- fit$draws("p_share")
> df_m4 <- fit$summary(c("beta_1", "beta_2", "mu_beta_1", "mu_beta_2", "mu_alpha", "theta", "p_share", "LL_alpha", "res_beta_1", "res_beta_2", "res_alpha"))
> save(df_m4, loo_m4, pred_m4, file = "out/m4.Rda")
> 
> gc();rm(fit);Sys.sleep(30);gc()
> 
> # full model ####
> stan_data$free_experts <- 1
> stan_data$country_issue_shocks <- 1
> stan_data$party_issue_shocks <- 1
> stan_data$country_shocks <- 1
> 
> fit <- mod$sample(data = stan_data, 
>                   init = initF,
>                   chains = 8,
>                   iter_warmup = 500, iter_sampling = 500)
> 
> loo_full <- loo(fit$draws("log_lik"))
> pred_full <- fit$draws("p_share")
> df_full <- fit$summary(c("beta_1", "beta_2", "mu_alpha", "mu_beta_1", "mu_beta_2", "theta", "res_beta_1", "res_beta_2", "res_alpha", "exp_scale", "LL_beta1", "LL_beta2", "LL_alpha", "idio", "shift_alpha", "scale_beta", "hyp_p", "p_share"))
> save(loo_full, pred_full, df_full, file = "out/full1.Rda")
> 
> rm(list = setdiff(ls(), "lf"))

> # Send message to log
> log_code()
> 
> 
> # ches 2019
> df_id <- read.csv("data/CHES2019V3.csv") %>% 
>   dplyr::select(country, eastwest, party_id) %>% 
>   distinct()
> df_pid <- read.csv("data/1999-2019_CHES_dataset_means(v1).csv")[,1:14] %>% 
>   filter(year == 2019)
> 
> df <- read.csv("data/CHES2019_experts.csv") %>% 
>   merge(df_id, by = "party_id") %>% 
>   filter({eastwest == 1 & !(country %in% c("cyp", "lux"))} | {is.na(eastwest) & !(country %in% c("tur", "swi", "nor", "ice"))}) %>% 
>   dplyr::select(country:eastwest, 
>                 party_id:party_name,
>                 immigrate_policy, multiculturalism, redistribution, environment, spendvtax, deregulation, econ_interven, civlib_laworder, sociallifestyle, religious_principles,
>                 ethnic_minorities, nationalism, urban_rural, protectionism, regions, # people_vs_elite, 
>                 eu_position = position, eu_cohesion, eu_foreign, eu_intmark, eu_budgets, eu_asylum, lrgen, lrecon, galtan) %>% 
>   mutate(expert = paste0(country, ".", id))
> 
> df$lrgen[df$lrgen == -1] <- NA
> df$lrecon[df$lrecon == -1] <- NA
> df$galtan[df$galtan == -1] <- NA
> df$lrecon[df$lrecon %in% c("", ".d")] <- NA
> df$galtan[df$galtan %in% c("", ".d")] <- NA
> df$lrecon <- as.numeric(df$lrecon)
> df$galtan <- as.numeric(df$galtan)
> 
> df[,7:21] <- df[,7:21] + 1
> 
> p_id <- 1:length(unique(df$party_id))
> c_id <- 1:length(unique(df$country))
> e_id <- 1:length(unique(df$expert))
> i_id <- 1:21
> 
> names(p_id) <- as.character(unique(df$party_id))
> names(c_id) <- unique(df$country)
> names(e_id) <- unique(df$expert)
> names(i_id) <- colnames(df[,7:27])
> 
> df$p_id <- p_id[as.character(df$party_id)]
> df$c_id <- c_id[df$country]
> df$e_id <- e_id[df$expert]
> 
> p_start <- df %>% 
>   select(p_id, lrgen, lrecon, galtan) %>% 
>   group_by(p_id) %>% 
>   summarize(lr = median(lrgen, na.rm = T),
>             lrecon = median(lrecon, na.rm = T),
>             galtan = median(galtan, na.rm = T)) %>% 
>   ungroup()
> p_start[,2:4] <- apply(p_start[,2:4], 2, function(x) (x - mean(x)) / sd(x))
> p_start <- p_start %>% 
>   arrange(p_id)
> 
> make_parameter <- function(df){
>   df <- df %>% 
>     mutate(parameter = as.factor(gsub("\\[.*]", "", variable)))
>   df
> }
> 
> # main scenario ####
> load("out/full1.Rda")
> full_df <- make_parameter(df_full) %>% 
>   filter(parameter %in% c("theta", "beta_1", "beta_2", "idio", "exp_scale", "scale_beta", "shift_alpha", "mu_alpha", "res_alpha"))
> 
> full_df <- bind_rows(
>   full_df %>% 
>     filter(parameter %in% c("exp_scale")) %>% 
>     mutate(info = names(e_id)),
>   full_df %>% 
>     filter(parameter %in% c("scale_beta")) %>% 
>     mutate(info = names(c_id)),
>   full_df %>% 
>     filter(parameter %in% c("shift_alpha")) %>% 
>     mutate(info = names(c_id)),
>   full_df %>% 
>     filter(parameter %in% c("res_alpha")) %>% 
>     mutate(item = rep(names(i_id), length.out = 315),
>            info = rep(names(c_id), each = 21, length.out = 315)),
>   full_df %>% 
>     filter(parameter %in% c("beta_1", "beta_2")) %>% 
>     mutate(item = rep(names(i_id), length.out = 630),
>            info = rep(names(c_id), each = 21, length.out = 630)),
>   full_df %>% 
>     filter(parameter %in% c("theta")) %>% 
>     mutate(party = rep(names(p_id), length.out = 256),
>            p_id = rep((p_id), length.out = 256)) %>% 
>     merge(df %>% select(p_id, country) %>% distinct(), sort = FALSE), # replace?!
>   full_df %>% 
>     filter(parameter %in% c("idio")) %>% 
>     mutate(item = rep(names(i_id), length.out = 2688),
>            party = rep(names(p_id), each = length(i_id), length.out = 2688),
>            p_id = rep((p_id), each = length(i_id), length.out = 2688))
> )
> 
> save(p_start, full_df, df_pid, file = "out/full2.Rda")
> 
> # alternative scenarios ####
> load("out/m0.Rda")
> load("out/m1.Rda")
> load("out/m2.Rda")
> load("out/m3.Rda")
> load("out/m4.Rda")
> 
> p_acc <- bind_rows(df_m0[df_m0$variable=="p_share",],
>                    df_m1[df_m1$variable=="p_share",],
>                    df_m2[df_m2$variable=="p_share",],
>                    df_m3[df_m3$variable=="p_share",],
>                    df_m4[df_m4$variable=="p_share",],
>                    df_full[df_full$variable=="p_share",]) %>% 
>   mutate(model = c("m0", "m1", "m2", "m3", "m4", "m5"))
> 
> loo <- bind_rows(loo_m0$estimates[1,],
>                    loo_m1$estimates[1,],
>                    loo_m2$estimates[1,],
>                    loo_m3$estimates[1,],
>                    loo_m4$estimates[1,],
>                    loo_full$estimates[1,]) %>% 
>   mutate(model = c("m0", "m1", "m2", "m3", "m4", "m5"))
> 
> save(p_acc, loo, file = "out/comp.Rda")
> 
> rm(list = setdiff(ls(), "lf"))

distinct: no rows removed

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 9.49448045935896 hours 

filter: removed 949 rows (79%), 247 rows remaining

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.033768892288208 secs 

filter: removed 2,127 rows (56%), 1,683 rows remaining

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.10341215133667 secs 

mutate: new variable 'expert' (character) with 191 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.0178596973419189 secs 

select: dropped 30 variables (country, eastwest, party_id, id, party, …)

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00819301605224609 secs 

group_by: one grouping variable (p_id)

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00473165512084961 secs 

summarize: now 128 rows and 4 columns, ungrouped

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.0154848098754883 secs 

ungroup: no grouping variables

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00167155265808105 secs 

mutate: new variable 'parameter' (factor) with 18 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.0189869403839111 secs 

filter: removed 1,888 rows (30%), 4,320 rows remaining

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.0316994190216064 secs 

filter: removed 4,129 rows (96%), 191 rows remaining

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00861978530883789 secs 

mutate: new variable 'info' (character) with 191 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00455904006958008 secs 

filter: removed 4,305 rows (>99%), 15 rows remaining

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00823140144348145 secs 

mutate: new variable 'info' (character) with 15 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00445055961608887 secs 

filter: removed 4,305 rows (>99%), 15 rows remaining

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00819873809814453 secs 

mutate: new variable 'info' (character) with 15 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00439095497131348 secs 

filter: removed 4,005 rows (93%), 315 rows remaining

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00821161270141602 secs 

mutate: new variable 'item' (character) with 21 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00447869300842285 secs 

        new variable 'info' (character) with 15 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.0019230842590332 secs 

filter: removed 3,690 rows (85%), 630 rows remaining

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00914192199707031 secs 

mutate: new variable 'item' (character) with 21 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00460433959960938 secs 

        new variable 'info' (character) with 15 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.0018458366394043 secs 

filter: removed 4,064 rows (94%), 256 rows remaining

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00826430320739746 secs 

mutate: new variable 'party' (character) with 128 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00456976890563965 secs 

        new variable 'p_id' (integer) with 128 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00183773040771484 secs 

select: dropped 32 variables (eastwest, party_id, id, party, party_name, …)

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00483536720275879 secs 

distinct: removed 1,555 rows (92%), 128 rows remaining

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00261878967285156 secs 

filter: removed 1,632 rows (38%), 2,688 rows remaining

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.0094754695892334 secs 

mutate: new variable 'item' (character) with 21 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00514936447143555 secs 

        new variable 'party' (character) with 128 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00192785263061523 secs 

        new variable 'p_id' (integer) with 128 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00190472602844238 secs 

mutate: new variable 'model' (character) with 6 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.0318176746368408 secs 

mutate: new variable 'model' (character) with 6 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00464344024658203 secs 

> # Send message to log
> log_code()
> 
> # figures ####
> load("out/full2.Rda")
> tmp_df <- full_df %>% 
>   filter(parameter == "theta") %>% 
>   select(mean, party, p_id, variable, country) %>% 
>   # mutate(dim = rep(c("d1", "d2"), length.out = 256)) %>%
>   mutate(dim = paste0("d", substr(variable, nchar(variable) - 1, nchar(variable) - 1))) %>%
>   select(-variable) %>% 
>   pivot_wider(names_from = dim, values_from = mean) %>% 
>   merge(p_start)
> 
> cor(tmp_df$d1, tmp_df$lrecon)
> cor(tmp_df$d2, tmp_df$galtan)
> 
> # figure 1 in main
> left_join(tmp_df %>% 
>             select(p_id, party, country, d1, d2) %>% 
>             pivot_longer(cols = c(d1, d2)) %>% 
>             rename(latent = value) %>% 
>             mutate(name = ifelse(name == "d1", "Economic Dimension", "GAL-TAN Dimension")),
>           tmp_df %>% 
>             select(p_id, party, country, lrecon, galtan) %>% 
>             pivot_longer(cols = c(lrecon, galtan)) %>% 
>             rename(experts = value) %>% 
>             mutate(name = ifelse(name == "lrecon", "Economic Dimension", "GAL-TAN Dimension"))) %>% 
>   ggplot(aes(experts, latent)) + geom_point() + geom_smooth(method = "lm") + theme_bw() + geom_abline(aes(intercept = 0, slope = 1)) + facet_wrap(~name) +
>   xlab("Mean Expert Placement") + ylab("Latent Estimate")
> # ggsave(file = "figures/cor_ideal.pdf", width = 3*1.61, height = 3)
> ggsave(file = "figures/fig1.pdf", width = 3*1.61, height = 3)
> 
> # figure 2 in main and figures 4, 5 in si
> tmp_df <- full_df %>% 
>   filter(parameter %in% c("beta_1", "beta_2")) %>% 
>   mutate(item.dimension = ifelse(item %in% c("eu_asylum", "eu_budgets", "eu_cohesion", "eu_foreign", "eu_intmark", "eu_position"), "EU Issues",
>                                  ifelse(item %in% c("civlib_laworder", "environment", "ethnic_minorities", "immigrate_policy", "multiculturalism", "nationalism", "regions", "religious_principles", "sociallifestyle", "urban_rural"), 
>                                         "Social/Cultural Issues", "Economic Issues")))
> 
> filter(tmp_df, parameter %in% c("beta_1", "beta_2")) %>% 
>   mutate(parameter = ifelse(parameter == "beta_1", "Economic Dimension", "GAL-TAN Dimension"),
>          item.dimension = factor(item.dimension, levels = c("Economic Issues", "Social/Cultural Issues", "EU Issues"))) %>%
>   ggplot(aes((item), mean)) + geom_hline(aes(yintercept = 0), linetype = 2) + geom_boxplot() + facet_grid(item.dimension~parameter, scales = "free", space = "free") + 
>   coord_flip() + theme_bw() + theme(legend.position = "") + ylab("Discrimination Estimate") + xlab("Issue") + labs(color = "")
> # ggsave("figures/disc_box.pdf", width = 5*1.61, height = 5)
> ggsave("figures/fig2.pdf", width = 5*1.61, height = 5)
> 
> filter(tmp_df, parameter %in% c("beta_1", "beta_2")) %>% 
>   mutate(parameter = ifelse(parameter == "beta_1", "Economic Dimension", "GAL-TAN Dimension"),
>          item.dimension = factor(item.dimension, levels = c("Economic Issues", "Social/Cultural Issues", "EU Issues"))) %>% 
>   filter(parameter == "Economic Dimension") %>% 
>   ggplot(aes(info, mean, ymin = q5, ymax = q95)) + geom_linerange() + geom_point() + theme_bw() + facet_wrap(~item, ncol = 4) + xlab("Country") + ylab("Discrimination Estimate") +
>   theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) + geom_hline(aes(yintercept = 0))
> # ggsave("figures/disc_econ.pdf", width = 4*1.61, height = 7)
> ggsave("figures/fig4.pdf", width = 4*1.61, height = 7)
> 
> filter(tmp_df, parameter %in% c("beta_1", "beta_2")) %>% 
>   mutate(parameter = ifelse(parameter == "beta_1", "Economic Dimension", "GAL-TAN Dimension"),
>          item.dimension = factor(item.dimension, levels = c("Economic Issues", "Social/Cultural Issues", "EU Issues"))) %>% 
>   filter(parameter != "Economic Dimension") %>% 
>   ggplot(aes(info, mean, ymin = q5, ymax = q95)) + geom_linerange() + geom_point() + theme_bw() + facet_wrap(~item, ncol = 4) + xlab("Country") + ylab("Discrimination Estimate") +
>   theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) + geom_hline(aes(yintercept = 0))
> # ggsave("figures/disc_galtan.pdf", width = 4*1.61, height = 7)
> ggsave("figures/fig5.pdf", width = 4*1.61, height = 7)
> 
> # figure 3 in main
> filter(full_df, parameter %in% c("idio")) %>% 
>   mutate(item.dimension = ifelse(item %in% c("eu_asylum", "eu_budgets", "eu_cohesion", "eu_foreign", "eu_intmark", "eu_position"), "EU Issues",
>                                  ifelse(item %in% c("civlib_laworder", "environment", "ethnic_minorities", "immigrate_policy", "multiculturalism", "nationalism", "regions", "religious_principles", "sociallifestyle", "urban_rural"), 
>                                         "Social/Cultural Issues", "Economic Issues"))) %>% 
>   mutate(item = fct_reorder(item, mean, .fun='sd')) %>% 
>   ggplot(aes(item, mean, fill = item.dimension)) + geom_hline(aes(yintercept = 0), linetype = 2) + geom_boxplot() + 
>   coord_flip() + theme_bw() + theme(legend.position = "bottom") + ylab("Idiosyncratic Shock") + xlab("Issue") + 
>   scale_fill_grey(start = .4, end = .9) + labs(fill = "")
> # ggsave("figures/idio.pdf", width = 4*1.61, height = 4)
> ggsave("figures/fig3.pdf", width = 4*1.61, height = 4)
> 
> # figure 6 in si
> filter(full_df,parameter %in% c("idio")) %>% 
>   mutate(item.dimension = ifelse(item %in% c("eu_asylum", "eu_budgets", "eu_cohesion", "eu_foreign", "eu_intmark", "eu_position"), "EU Issues",
>                                  ifelse(item %in% c("civlib_laworder", "environment", "ethnic_minorities", "immigrate_policy", "multiculturalism", "nationalism", "regions", "religious_principles", "sociallifestyle", "urban_rural"), 
>                                         "Social/Cultural Issues", "Economic Issues"))) %>% 
>   mutate(item = fct_reorder(item, mean, .fun='sd')) %>% 
>   merge(df_pid %>% select(party = party_id, family)) %>% 
>   merge(data.frame(family = 1:11, family.name = c("Radical Right", "Conservatives", "Liberal", "Christian-Democratic", "Socialist", "Radical Left", "Green", "Regionalist", "No Family", "Confessional", "Agrarian/Center"))) %>% 
>   filter(family %in% c(1:8, 10:11)) %>% 
>   ggplot(aes(item, mean, fill = item.dimension)) + geom_hline(aes(yintercept = 0), linetype = 2) + geom_boxplot() + facet_wrap(~family.name, ncol = 3) +
>   coord_flip() + theme_bw() + theme(legend.position = "bottom") + ylab("Mean Idiosyncratic Shock") + xlab("Issue") + 
>   scale_fill_grey(start = .4, end = .9) + labs(fill = "")
> # ggsave("figures/idio_party.pdf", width = 9, height = 12)
> ggsave("figures/fig6.pdf", width = 9, height = 12)
> 
> # figures 7:10 in si
> full_df %>% 
>   filter(parameter == "res_alpha") %>% 
>   select(mean, q5, q95, country, item) %>% 
>   mutate(item = fct_reorder(item, mean, .fun='sd')) %>% 
>   mutate(item.dimension = ifelse(item %in% c("eu_asylum", "eu_budgets", "eu_cohesion", "eu_foreign", "eu_intmark", "eu_position"), "EU Issues",
>                                  ifelse(item %in% c("civlib_laworder", "environment", "ethnic_minorities", "immigrate_policy", "multiculturalism", "nationalism", "regions", "religious_principles", "sociallifestyle", "urban_rural"), 
>                                         "Social/Cultural Issues", "Economic Issues"))) %>% 
>   ggplot(aes(item, mean, ymin = q5, ymax = q95, fill = item.dimension)) + geom_hline(yintercept = 0) + geom_boxplot() + theme_bw() + coord_flip() +
>   xlab("Issue") + ylab("Estimate") + theme(legend.position = "bottom") +
>   scale_fill_grey(start = .4, end = .9) + labs(fill = "")
> # ggsave(file = "figures/shift_issue_country.pdf", width = 4*1.61, height = 4)
> ggsave(file = "figures/fig7.pdf", width = 4*1.61, height = 4)
> 
> full_df %>% 
>   filter(parameter == "scale_beta") %>% 
>   select(mean, q5, q95, info) %>% 
>   mutate(info = fct_reorder(info, mean, .fun='mean')) %>% 
>   ggplot(aes(info, mean, ymin = q5, ymax = q95)) + geom_pointrange() + theme_bw() + 
>   geom_hline(yintercept = 1) + xlab("Country") + ylab("Estimate")
> # ggsave(file = "figures/scale_country.pdf", width = 2.25*1.61, height = 2.25)
> ggsave(file = "figures/fig8.pdf", width = 2.25*1.61, height = 2.25)
> 
> full_df %>% 
>   filter(parameter == "shift_alpha") %>% 
>   select(mean, q5, q95, info) %>% 
>   mutate(info = fct_reorder(info, mean, .fun='mean')) %>% 
>   ggplot(aes(info, mean, ymin = q5, ymax = q95)) + geom_pointrange() + theme_bw() + 
>   geom_hline(yintercept = 0) + xlab("Country") + ylab("Estimate")
> # ggsave(file = "figures/shift_country.pdf", width = 2.25*1.61, height = 2.25)
> ggsave(file = "figures/fig9.pdf", width = 2.25*1.61, height = 2.25)
> 
> full_df %>% 
>   filter(parameter == "exp_scale") %>% 
>   separate(info, c("country", "expert")) %>% 
>   select(mean, country, expert) %>% 
>   mutate(country = fct_reorder(country, mean, .fun='median')) %>% 
>   ggplot(aes(country, mean)) + geom_hline(yintercept = 1) + geom_boxplot() + theme_bw() + xlab("Country") + ylab("Estimate")
> # ggsave(file = "figures/expert_error.pdf", width = 2.25*1.61, height = 2.25)
> ggsave(file = "figures/fig10.pdf", width = 2.25*1.61, height = 2.25)
> 
> rm(list = ls())
> 
> # model comparison ####
> load("out/comp.Rda")
> 
> change_df <- data.frame(old = paste0("m", 0:5),
>                         new = paste0("Model ", c(1, 4, 5, 2, 3, 6)))
> 
> loo  %>% 
>   select(old = model, Estimate, SE) %>% 
>   merge(change_df) %>% 
>   arrange(new) %>% 
>   ggplot(aes(as.character(1:6), Estimate, ymin = Estimate - 1.96 * SE, ymax = Estimate + 1.96 * SE)) + geom_pointrange() + theme_bw() + xlab("Model") + ylab("ELPD-LOO")
> # ggsave(file = "figures/loo.pdf", width = 3, height = 2.5)
> ggsave(file = "figures/fig11b.pdf", width = 3, height = 2.5)
> 
> p_acc  %>% 
>   select(old = model, mean, q5, q95) %>% 
>   merge(change_df) %>% 
>   arrange(new) %>% 
>   ggplot(aes(as.character(1:6), mean, ymin = q5, ymax = q95)) + geom_pointrange() + theme_bw() + xlab("Model") + ylab("Predictive Accuracy")
> # ggsave(file = "figures/p_acc.pdf", width = 3, height = 2.5)
> ggsave(file = "figures/fig11a.pdf", width = 3, height = 2.5)
> 
> loo <- loo %>% 
>   mutate(ELPD_LOO = paste0(round(Estimate, 3), " (", round(SE, 3), ")")) %>% 
>   select(old = model, ELPD_LOO) %>% 
>   merge(change_df) %>% 
>   select(-old)
> 
> p_acc <- p_acc %>% 
>   mutate(Acc. = paste0(round(mean, 3), " (", round(q5, 3), "--", round(q95, 3), ")")) %>% 
>   select(old = model, Acc.) %>% 
>   merge(change_df) %>% 
>   select(-old)
> 
> m_comp <- merge(loo, p_acc) %>% 
>   rename(Model = new)
> names(m_comp) <- c("Model", "ELPD-LOO", "Accuracy")
> 
> fileConn <- file("tables/mod_comp.tex")
> writeLines(print(xtable(m_comp, 
>                         align = c("cc|cc"),
>                         caption = "Model comparison results",
>                         label = "tab:mod_comp_res"), booktabs = TRUE, include.rownames = FALSE), fileConn)
> close(fileConn)
> 

filter: removed 3,854 rows (94%), 256 rows remaining

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.0171990394592285 secs 

select: dropped 11 variables (median, sd, mad, q5, q95, …)

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00585508346557617 secs 

mutate: new variable 'dim' (character) with 2 unique values and 0% NA

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00442862510681152 secs 

select: dropped one variable (variable)

NOTE: Log Print Time:  2023-04-18 18:32:36 
NOTE: Elapsed Time: 0.00413823127746582 secs 

pivot_wider: reorganized (mean, dim) into (d1, d2) [was 256x5, now 128x5]

NOTE: Log Print Time:  2023-04-18 18:32:37 
NOTE: Elapsed Time: 0.0121321678161621 secs 

select: dropped 3 variables (lr, lrecon, galtan)

NOTE: Log Print Time:  2023-04-18 18:32:37 
NOTE: Elapsed Time: 0.00721454620361328 secs 

pivot_longer: reorganized (d1, d2) into (name, value) [was 128x5, now 256x5]

NOTE: Log Print Time:  2023-04-18 18:32:37 
NOTE: Elapsed Time: 0.00635147094726562 secs 

rename: renamed one variable (latent)

NOTE: Log Print Time:  2023-04-18 18:32:37 
NOTE: Elapsed Time: 0.0353620052337646 secs 

mutate: changed 256 values (100%) of 'name' (0 new NA)

NOTE: Log Print Time:  2023-04-18 18:32:37 
NOTE: Elapsed Time: 0.00517845153808594 secs 

select: dropped 3 variables (d1, d2, lr)

NOTE: Log Print Time:  2023-04-18 18:32:37 
NOTE: Elapsed Time: 0.00573825836181641 secs 

pivot_longer: reorganized (lrecon, galtan) into (name, value) [was 128x5, now 256x5]

NOTE: Log Print Time:  2023-04-18 18:32:37 
NOTE: Elapsed Time: 0.00595593452453613 secs 

rename: renamed one variable (experts)

NOTE: Log Print Time:  2023-04-18 18:32:37 
NOTE: Elapsed Time: 0.00311970710754395 secs 

mutate: changed 256 values (100%) of 'name' (0 new NA)

NOTE: Log Print Time:  2023-04-18 18:32:37 
NOTE: Elapsed Time: 0.00450420379638672 secs 

left_join: added one column (experts)

NOTE: Log Print Time:  2023-04-19 05:22:40 
NOTE: Elapsed Time: 10.8344214312898 hours 

           > rows only in x     0

NOTE: Log Print Time:  2023-04-19 05:22:41 
NOTE: Elapsed Time: 0.0828742980957031 secs 

           > rows only in y  (  0)

NOTE: Log Print Time:  2023-04-19 05:22:41 
NOTE: Elapsed Time: 0.00268793106079102 secs 

           > matched rows     256

NOTE: Log Print Time:  2023-04-19 05:22:41 
NOTE: Elapsed Time: 0.00273489952087402 secs 

           >                 =====

NOTE: Log Print Time:  2023-04-19 05:22:41 
NOTE: Elapsed Time: 0.00259852409362793 secs 

           > rows total       256

NOTE: Log Print Time:  2023-04-19 05:22:41 
NOTE: Elapsed Time: 0.00237202644348145 secs 

filter: removed 3,480 rows (85%), 630 rows remaining

NOTE: Log Print Time:  2023-04-19 05:22:41 
NOTE: Elapsed Time: 0.524618625640869 secs 

mutate: new variable 'item.dimension' (character) with 3 unique values and 0% NA

NOTE: Log Print Time:  2023-04-19 05:22:41 
NOTE: Elapsed Time: 0.00612735748291016 secs 

filter: no rows removed

NOTE: Log Print Time:  2023-04-19 05:22:41 
NOTE: Elapsed Time: 0.0101921558380127 secs 

mutate: converted 'parameter' from factor to character (0 new NA)

NOTE: Log Print Time:  2023-04-19 05:22:41 
NOTE: Elapsed Time: 0.00548958778381348 secs 

        converted 'item.dimension' from character to factor (0 new NA)

NOTE: Log Print Time:  2023-04-19 05:22:41 
NOTE: Elapsed Time: 0.00223040580749512 secs 

filter: no rows removed

NOTE: Log Print Time:  2023-04-19 05:22:42 
NOTE: Elapsed Time: 0.602376461029053 secs 

mutate: converted 'parameter' from factor to character (0 new NA)

NOTE: Log Print Time:  2023-04-19 05:22:42 
NOTE: Elapsed Time: 0.00491476058959961 secs 

        converted 'item.dimension' from character to factor (0 new NA)

NOTE: Log Print Time:  2023-04-19 05:22:42 
NOTE: Elapsed Time: 0.00197291374206543 secs 

filter: removed 315 rows (50%), 315 rows remaining

NOTE: Log Print Time:  2023-04-19 05:22:42 
NOTE: Elapsed Time: 0.00636482238769531 secs 

filter: no rows removed

NOTE: Log Print Time:  2023-04-19 05:22:43 
NOTE: Elapsed Time: 0.817434549331665 secs 

mutate: converted 'parameter' from factor to character (0 new NA)

NOTE: Log Print Time:  2023-04-19 05:22:43 
NOTE: Elapsed Time: 0.00494575500488281 secs 

        converted 'item.dimension' from character to factor (0 new NA)

NOTE: Log Print Time:  2023-04-19 05:22:43 
NOTE: Elapsed Time: 0.00210714340209961 secs 

filter: removed 315 rows (50%), 315 rows remaining

NOTE: Log Print Time:  2023-04-19 05:22:43 
NOTE: Elapsed Time: 0.00638079643249512 secs 

filter: removed 1,422 rows (35%), 2,688 rows remaining

NOTE: Log Print Time:  2023-04-19 05:22:44 
NOTE: Elapsed Time: 0.994372129440308 secs 

mutate: new variable 'item.dimension' (character) with 3 unique values and 0% NA

NOTE: Log Print Time:  2023-04-19 05:22:44 
NOTE: Elapsed Time: 0.00633621215820312 secs 

mutate: converted 'item' from character to factor (0 new NA)

NOTE: Log Print Time:  2023-04-19 05:22:44 
NOTE: Elapsed Time: 0.00613307952880859 secs 

filter: removed 1,422 rows (35%), 2,688 rows remaining

NOTE: Log Print Time:  2023-04-19 05:22:44 
NOTE: Elapsed Time: 0.35050368309021 secs 

mutate: new variable 'item.dimension' (character) with 3 unique values and 0% NA

NOTE: Log Print Time:  2023-04-19 05:22:44 
NOTE: Elapsed Time: 0.00596976280212402 secs 

mutate: converted 'item' from character to factor (0 new NA)

NOTE: Log Print Time:  2023-04-19 05:22:44 
NOTE: Elapsed Time: 0.00558924674987793 secs 

select: dropped 12 variables (country, eastwest, eumember, year, expert, …)

NOTE: Log Print Time:  2023-04-19 05:22:44 
NOTE: Elapsed Time: 0.00550746917724609 secs 

filter: removed 84 rows (3%), 2,583 rows remaining

NOTE: Log Print Time:  2023-04-19 05:22:44 
NOTE: Elapsed Time: 0.0233697891235352 secs 

filter: removed 3,795 rows (92%), 315 rows remaining

NOTE: Log Print Time:  2023-04-19 05:22:46 
NOTE: Elapsed Time: 2.00773024559021 secs 

select: dropped 11 variables (variable, median, sd, mad, rhat, …)

NOTE: Log Print Time:  2023-04-19 05:22:46 
NOTE: Elapsed Time: 0.00585508346557617 secs 

mutate: converted 'item' from character to factor (0 new NA)

NOTE: Log Print Time:  2023-04-19 05:22:46 
NOTE: Elapsed Time: 0.00517177581787109 secs 

mutate: new variable 'item.dimension' (character) with 3 unique values and 0% NA

NOTE: Log Print Time:  2023-04-19 05:22:46 
NOTE: Elapsed Time: 0.00441741943359375 secs 

filter: removed 4,095 rows (>99%), 15 rows remaining

NOTE: Log Print Time:  2023-04-19 05:22:46 
NOTE: Elapsed Time: 0.278744220733643 secs 

select: dropped 12 variables (variable, median, sd, mad, rhat, …)

NOTE: Log Print Time:  2023-04-19 05:22:46 
NOTE: Elapsed Time: 0.00527691841125488 secs 

mutate: converted 'info' from character to factor (0 new NA)

NOTE: Log Print Time:  2023-04-19 05:22:46 
NOTE: Elapsed Time: 0.00483036041259766 secs 

filter: removed 4,095 rows (>99%), 15 rows remaining

NOTE: Log Print Time:  2023-04-19 05:22:46 
NOTE: Elapsed Time: 0.109549760818481 secs 

select: dropped 12 variables (variable, median, sd, mad, rhat, …)

NOTE: Log Print Time:  2023-04-19 05:22:46 
NOTE: Elapsed Time: 0.0064549446105957 secs 

mutate: converted 'info' from character to factor (0 new NA)

NOTE: Log Print Time:  2023-04-19 05:22:46 
NOTE: Elapsed Time: 0.00530147552490234 secs 

filter: removed 3,919 rows (95%), 191 rows remaining

NOTE: Log Print Time:  2023-04-19 05:22:47 
NOTE: Elapsed Time: 0.0848319530487061 secs 

select: dropped 13 variables (variable, median, sd, mad, q5, …)

NOTE: Log Print Time:  2023-04-19 05:22:47 
NOTE: Elapsed Time: 0.010500431060791 secs 

mutate: converted 'country' from character to factor (0 new NA)

NOTE: Log Print Time:  2023-04-19 05:22:47 
NOTE: Elapsed Time: 0.0052802562713623 secs 

select: renamed one variable (old)

NOTE: Log Print Time:  2023-04-19 05:22:47 
NOTE: Elapsed Time: 0.180254459381104 secs 

select: renamed one variable (old) and dropped 7 variables

NOTE: Log Print Time:  2023-04-19 05:22:47 
NOTE: Elapsed Time: 0.0801877975463867 secs 

mutate: new variable 'ELPD_LOO' (character) with 6 unique values and 0% NA

NOTE: Log Print Time:  2023-04-19 05:22:47 
NOTE: Elapsed Time: 0.10509467124939 secs 

select: renamed one variable (old) and dropped 2 variables

NOTE: Log Print Time:  2023-04-19 05:22:47 
NOTE: Elapsed Time: 0.00444841384887695 secs 

select: dropped one variable (old)

NOTE: Log Print Time:  2023-04-19 05:22:47 
NOTE: Elapsed Time: 0.0042874813079834 secs 

mutate: new variable 'Acc.' (character) with 6 unique values and 0% NA

NOTE: Log Print Time:  2023-04-19 05:22:47 
NOTE: Elapsed Time: 0.0047299861907959 secs 

select: renamed one variable (old) and dropped 10 variables

NOTE: Log Print Time:  2023-04-19 05:22:47 
NOTE: Elapsed Time: 0.00429391860961914 secs 

select: dropped one variable (old)

NOTE: Log Print Time:  2023-04-19 05:22:47 
NOTE: Elapsed Time: 0.00401163101196289 secs 

rename: renamed one variable (Model)

NOTE: Log Print Time:  2023-04-19 05:22:47 
NOTE: Elapsed Time: 0.00353622436523438 secs 

Warning messages:
1: In readLines(pth, encoding = "UTF-8") :
  incomplete final line found on '/home/rstudio/spasim_repl/01_run_models.R'
2: Relative effective sample sizes ('r_eff' argument) not specified.
For models fit with MCMC, the reported PSIS effective sample sizes and 
MCSE estimates will be over-optimistic.
3: Some Pareto k diagnostic values are slightly high. See help('pareto-k-diagnostic') for details.

4: Relative effective sample sizes ('r_eff' argument) not specified.
For models fit with MCMC, the reported PSIS effective sample sizes and 
MCSE estimates will be over-optimistic.
5: Some Pareto k diagnostic values are too high. See help('pareto-k-diagnostic') for details.

6: Relative effective sample sizes ('r_eff' argument) not specified.
For models fit with MCMC, the reported PSIS effective sample sizes and 
MCSE estimates will be over-optimistic.
7: Some Pareto k diagnostic values are too high. See help('pareto-k-diagnostic') for details.

8: Relative effective sample sizes ('r_eff' argument) not specified.
For models fit with MCMC, the reported PSIS effective sample sizes and 
MCSE estimates will be over-optimistic.
9: Some Pareto k diagnostic values are too high. See help('pareto-k-diagnostic') for details.

10: Relative effective sample sizes ('r_eff' argument) not specified.
For models fit with MCMC, the reported PSIS effective sample sizes and 
MCSE estimates will be over-optimistic.
11: Some Pareto k diagnostic values are slightly high. See help('pareto-k-diagnostic') for details.

12: Relative effective sample sizes ('r_eff' argument) not specified.
For models fit with MCMC, the reported PSIS effective sample sizes and 
MCSE estimates will be over-optimistic.
13: Some Pareto k diagnostic values are too high. See help('pareto-k-diagnostic') for details.


NOTE: Log Print Time: 2023-04-19 05:22:47 
NOTE: Log Elapsed Time: 0.438310623168945 

========================================================================= 
Log End Time: 2023-04-19 05:22:47 
Log Elapsed Time: 0 20:19:51 
========================================================================= 
